import Cookies from 'js-cookie'

const TOKEN = 'sso_sessionid'
const USERID = "userId"
const APPLICATION = 'application'
const USERNAME = 'h5_username'
const NAME = "h5_name"

export function getToken() {
  return Cookies.get(TOKEN)
}

export function setToken(token) {
  return Cookies.set(TOKEN, token)
}

export function setH5Name(username) {
  return Cookies.set(NAME, username)
}
export function getH5Name() {
  return Cookies.get(NAME)
}
export function removeH5Name() {
  return Cookies.remove(NAME)
}


export function setH5Username(username) {
  console.log('useraaaa---------------',username)
  return Cookies.set(USERNAME, username)
}
export function getH5Username() {
  return Cookies.get(USERNAME)
}
export function removeH5Username() {
  return Cookies.remove(USERNAME)
}
export function removeToken() {
  return Cookies.remove(TOKEN)
}

//
export function getApplication() {
  return Cookies.get(APPLICATION)
}

export function setApplication(application = 'icims-admin') {
  return Cookies.set(APPLICATION, application)
}

export function removeApplication() {
  return Cookies.remove(APPLICATION)
}

//
export function getUserId() {
  return Cookies.get(USERID)
}

export function setUserId(userId) {
  return Cookies.set(USERID, userId)
}

export function removeUserId() {
  return Cookies.remove(USERID)
}


const H5_TOKEN = 'h5_sso_sessionid'
const H5_USERID = "h5_userId"
const H5_APPLICATION = 'h5_application'
const H5ID = 'H5_id'

export function getH5Token() {
  return Cookies.get(H5_TOKEN)
}

export function setH5Token(token) {
  return Cookies.set(H5_TOKEN, token)
}

export function removeH5Token() {
  return Cookies.remove(H5_TOKEN)
}

export function getH5Application() {
  return Cookies.get(H5_APPLICATION)
}

export function setH5Application(application = 'icims-admin') {
  return Cookies.set(H5_APPLICATION, application)
}

export function removeH5Application() {
  return Cookies.remove(H5_APPLICATION)
}

//
export function getH5UserId() {
  return Cookies.get(H5_USERID)
}

export function setH5UserId(userId) {
  return Cookies.set(H5_USERID, userId)
}

export function removeH5UserId() {
  return Cookies.remove(H5_USERID)
}

export function setH5Id() {
  return Cookies.set(H5ID, 'H5')
}
export function getH5Id() {
  return Cookies.get(H5ID)
}
export function removeH5Id() {
  return Cookies.get(H5ID)
}

